@extends('layouts.ajax_master')
@section('app_js')

@stop
@section('content')
    @if($count==0)
        <div class="shopping">
            <div class="main">
                <div class="shopping-no">
                    <div class="box">
                        <i></i>
                        <span>购物车内没有商品。</span>
                        <a href="/shopping">去商城选购&#62;&#62;</a>
                    </div>
                </div>
            </div>
        </div>
    @else
    <div class="title">全部商品{{$count}}个</div>
    <div class="table" >
        <table>
            <thead>
            <tr>
                <th width="70px"><input type="checkbox" class="check-all" id="check-all" checked>全选</th>
                <th width="260px">商品信息</th>
                <th width="120px">钢厂</th>
                <th width="130px">单价</th>
                <th width="130px">件重</th>
                <th width="90px">件数</th>
                <th width="165px">数量</th>
                <th width="145px">合计</th>
                <th width="">操作</th>
            </tr>
            <tr>
                <th colspan="9" class="bg"></th>
            </tr>
            </thead>
            @foreach($data as $v)
                <tbody>
                <tr class="first">
                    <td colspan="9">
                        <input type="checkbox" class="check-bus" checked>{{$v->storage_place}} {{$v->storage_name}}
                        <span>地址：{{$v->storage_address}}</span>
                        <span>联系电话：{{$v->storage_phone}}</span>
                    </td>
                </tr>
                @foreach($v->cart_info as $vv)
                    <tr class="info" stock="{{$vv->useable_stock}}">
                        <td><div><input type="checkbox" cart-id="{{$vv->cart_id}}" checked></div></td>
                        <td><div>{{$vv->brand_name}}   {{$vv->m_name}}   {{$vv->product_spec}}</div></td>
                        <td><div>{{$vv->storage_name}}</div></td>
                        <td><div>￥{{$vv->product_price}}</div></td>
                        <td><div>{{$vv->piece_weight}}吨/件</div></td>
                        <td><div>{{$vv->useable_stock}}</div></td>
                        <td>
                            <div class="info-num">
                                <a href="javascript:;" class="pre"></a>
                                <input type="text" id="info-num" value="{{$vv->number}}" class="number">
                                <a href="javascript:;" class="next"></a>
                            </div>
                        </td>
                        <td><div class="total"><span>￥{{round($vv->product_price*$vv->number*$vv->piece_weight,2)}}</span></div></td>
                        <td><a href="javascript:;" class="del"  data-cart_id="{{ $vv->cart_id }}">删除</a></td>
                    </tr>
                @endforeach
                <tr class="bg">
                    <td colspan="9"></td>
                </tr>
                </tbody>
            @endforeach
        </table>
        <div class="statistics">
            <div class="function left">
                <input type="checkbox" class="check-all" id="check-all" checked>全选
                <a href="javascript:;" class="delete">删除选中的商品</a>
            </div>
            <div class="go right">
                @if(!empty($data))
                    <a href="shop_cart_submit?cart_id={{$cart_id}}" id="cart-submit">去下单</a>
                @else
                @endif
            </div>
            <div class="sta-mon right">
                商品总金额（不含运费）: <span>￥{{round($sum[0]->price,2)}}</span>
            </div>
            <div class="sta-num right">
                商品重量小计：共 <span>{{$count}}</span> 件  {{round($sum[0]->weight,3)}}吨
            </div>
        </div>
    </div>
        @endif